//
//  ProfileBigController.m
//  LoveFreshBeen
//
//  Created by vinsent on 16/10/15.
//  Copyright © 2016年 魏根. All rights reserved.
//

#import "ProfileBigController.h"
#import "ProfileViewController.h"
#import "MySettingController.h"

@interface ProfileBigController ()

@property(nonatomic,strong) ProfileViewController *contentTVC;
@property(nonatomic,weak) UIView *headV;
@end

@implementation ProfileBigController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatHeaderView];
    _contentTVC = [[ProfileViewController alloc] init];
    [self addChildViewController:_contentTVC];
    [self.view addSubview:_contentTVC.tableView];
    [_contentTVC.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.headV.mas_bottom);
        make.leading.trailing.bottom.equalTo(self.view);
    }];
}
- (void) creatHeaderView {
    UIView *head = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height / 4)];
    self.headV = head;
    [self.view addSubview:head];
    head.backgroundColor = [UIColor orangeColor];
    
    UIImageView *bj = [[UIImageView alloc] initWithFrame:head.bounds];
    bj.image = [UIImage imageNamed:@"v2_my_avatar_bg"];
    [head addSubview:bj];
    
    [bj setUserInteractionEnabled:YES];
    
    UIButton *setBtn = [[UIButton alloc] init];
    [setBtn setImage:[UIImage imageNamed:@"v2_my_settings_icon"] forState:UIControlStateNormal];
    [bj addSubview:setBtn];
    [setBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bj).offset(17);
        make.trailing.equalTo(bj).offset(-17);
    }];
    [setBtn sizeToFit];
    
    [setBtn addTarget:self action:@selector(setBtnDidClick:) forControlEvents:UIControlEventTouchUpInside];
    
    UIImageView *perHead = [[UIImageView alloc] init];
    perHead.image = [UIImage imageNamed:@"v2_my_avatar"];
    [head addSubview:perHead];
    [perHead mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(head);
        make.centerY.equalTo(head).offset(-20);
    }];
    
    UILabel *tel = [[UILabel alloc] init];
    tel.text = @"15267885780";
    tel.textColor = [UIColor whiteColor];
    [head addSubview:tel];
    [tel sizeToFit];
    [tel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(perHead.mas_bottom).offset(7);
        make.centerX.equalTo(head);
    }];
    
  
    
    
}

  //设置按钮点击事件

- (void)setBtnDidClick:(UIButton *)btn{
    

    MySettingController *settingTC = [[MySettingController alloc]init];
    
    [self.navigationController pushViewController:settingTC animated:YES];
}


- (void)viewWillDisappear:(BOOL)animated{
    
//    [self.tabBarController.tabBar setHidden:YES];
}


@end
